# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=nutsnbolts

pkgbase=mingw-w64-${_realname}-hg
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-hg"
pkgver=r153.b92bf74dc55f
pkgrel=1
pkgdesc="Extension library for Coin that contains various nuts and bolts (mingw-w64)"
arch=('any')
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-coin3d")
makedepends=("mercurial" "${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-gcc")
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}")
url='https://bitbucket.org/Coin3D/dime'
source=("${_realname}"::"hg+https://bitbucket.org/Alexpux/nutsnbolts"
    #"hg+https://bitbucket.org/Alexpux/coincodeshare"
    )
options=(!strip staticlibs)
sha256sums=('SKIP'
            #'SKIP'
           )

pkgver() {
  cd "$srcdir/$_realname"
  printf "r%s.%s" "$(hg identify -n)" "$(hg identify -i)"
}

prepare() {
  cd ${srcdir}/${_realname}
}

build() {
  #export lt_cv_deplibs_check_method='pass_all'
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  mkdir ${srcdir}/build-${MINGW_CHOST}
  cd ${srcdir}/build-${MINGW_CHOST}
  ../"${_realname}"/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --disable-static \
    --enable-optimization \
    --disable-debug \
    --with-coin=${MINGW_PREFIX}
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}
